package com.tian.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("main");
        registry.addViewController("/main").setViewName("main");
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/Path/**").addResourceLocations("file:/E:/view/");
        registry.addResourceHandler("/Path1/**").addResourceLocations("file:/E:/view/galaxy/");
        registry.addResourceHandler("/Path2/**").addResourceLocations("file:/E:/view/anime/");
        registry.addResourceHandler("/image/**").addResourceLocations("file:/E:/view/image/");
        registry.addResourceHandler("/")
                .addResourceLocations("classpath:/static/**")
        ;
    }
}
